import moduleRegist from '@/utils/moduleRegist';
import { module as appModule } from './module';
// import payManage from './payManage';
// import orderManage from './orderManage';
// import reconcileManage from './reconcileManage';
// import configManage from './configManage';
import trade from './trade';
//window.routeConfig = [...orderManage, ...payManage, ...reconcileManage, ...configManage];

const Layout = resolve => {
  require(['./Layout'], resolve);
};

const Signin = resolve => {
  require(['./Signin'], resolve);
};

const CallBack = resolve => {
  require(['./CallBack'], resolve);
};


const CashRegister = resolve => {
  require(['./CashRegister'], resolve);
};

const NoPermission = resolve => {
  require(['@/components/NoPermission'], resolve);
};

const routeConfig = {
  path: '/',
  redirect: '/home',
  component: Layout,
  meta: {
    title: '首页',
    name: '首页'
  },
  children: [{
    path: 'signin',
    component: Signin,
    meta: {
      title: '登陆',
      name: '登陆',
      icon: 'md-lock',
      noAuthc: true
    }
  }, {
    path: 'callBack',
    component: CallBack,
    meta: {
      title: '登陆',
      name: '登陆',
      icon: 'md-lock',
      noAuthc: true
    }
  },
  {
    path: 'cashRegister',
    component: CashRegister,
    meta: {
      title: '统一收银台',
      name: '统一收银台',
      icon: 'md-lock',
      noAuthc: true
    }
  }, {
    path: '403',
    component: NoPermission,
    meta: {
      title: '403',
      name: '403',
      icon: 'md-lock'
    }
  }, ...trade],
  beforeEnter: (to, from, next) => {
    moduleRegist(appModule);
    next();
  }
};
export default [routeConfig];
//...orderManage, ...payManage, ...reconcileManage, ...configManage
